package com.hwh.controller;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.hwh.service.OrdersService;
import com.hwh.serviceIm.OrdersServiceImpl;
import com.hwh.vo.Orders;

public class SelAllOrderController extends HttpServlet {
	
	
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) 
	         throws ServletException, IOException {
       super.doPost(req, resp);
    }
	
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		
		ArrayList<Orders> orders= new ArrayList<Orders>();
		OrdersService os = new OrdersServiceImpl();
        
        
		orders= os.getOrders();
        
        //将orders对象放入session中,前台用EL表达式获取值
        HttpSession session= req.getSession();
        
        session.setAttribute("orders", orders);
        
        req.getRequestDispatcher("aorders.jsp").forward(req, resp);
		
		
		
	}
	
	
}
